<?php
require 'db.php';
require 'function.php';
$shop = new Manager($link);
if (isset($_POST['submit'])){
    $name = $_POST['name'];
    $price = $_POST['price'];
    $o_price = $_POST['o_price'];
    $img = $_POST['img'];
    $descript = $_POST['descript'];
    $category = $_POST['category'];
    
    $query = $shop->addShop($name, $price,$o_price,$img,$descript,$category);
    if ($query){
        header("Location:m_shop.php");
    }
    else{
        echo "<script>alert('添加失败！');</script>";
        echo "<script>history.go(-1);</script>";
        header("Location:m_shop.php");
    }
    
}

require 'sadd.html';
?>